---
title: "Flexdashboard: An Interactive Dashboard Solution for R Users"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source: embed
---
# Intro Text {.sidebar}
Over the years as I have created more and more Shiny repositories, it has gotten harder for me to host new Shiny dashboards for free. It turns out that the flexdashboard package allows me to create nice looking HTML dashboards using simple RMarkdown syntax. You can add interactivity with htmlwidgets.
```{r include = FALSE}
knitr::opts_chunk$set(cache = TRUE)
library(dplyr)
library(highcharter)
library(viridisLite)
library(ggplot2)
library(crosstalk)
data(unemployment)
data(uscountygeojson)
thm <-
hc_theme(
chart = list(
backgroundColor = "transparent",
style = list(fontFamily = "Source Sans Pro")
),
xAxis = list(
gridLineWidth = 1
)
)
data("USArrests", package = "datasets")
data("usgeojson")
USArrests <- USArrests %>%
mutate(state = rownames(.))
#n <- 4
#colstops <- data.frame(
# q = 0:n/n,
# c = substring(viridis(n + 1), 0, 7)) %>%
# list.parse2()
```
# GIS Dashboard Example {data-icon="fa.list"}
## Column {data-height=350}
### ggplot2 Plots
```{r}
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
geom_smooth()
```
## Column {data-height=650 .tabset .tabset-fade}
### htmlwidgets {data-width=300}
```{r}
highchart() %>%
hc_add_series_map(usgeojson, USArrests, name = "Sales",
value = "Murder", joinBy = c("woename", "state"),
dataLabels = list(enabled = TRUE,
format = '{point.properties.postalcode}')) %>%
#hc_colorAxis(stops = colstops) %>%
hc_legend(valueDecimals = 0, valueSuffix = "%") %>%
hc_mapNavigation(enabled = TRUE) %>%
hc_add_theme(thm)
```
# Iris Flower Dataset {data-icon="fa.map"}
### tables {data-width=700}
```{r}
library(DT)
datatable(iris, options = list(pageLength = 10))
```